<?php
/**
 * Created by PhpStorm.
 * User: boye009
 * Date: 2016/3/17
 * Time: 11:02
 */

namespace Test\Controller;

use Common\Api\BoyeServiceApi;

class TestBbsUserCenterController extends TestController{

    public function index(){
        $this->display();
    }

    public function getUserInfo(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',''),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_getUserInfo',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();
    }

    public function queryThread(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',0),
                'page_no' => I('post.page_no',1),
                'page_size' => I('post.page_size',6),
                'img_num' => I('post.img_num',3),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_queryThread',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();

    }

    public function queryPost(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',0),
                'page_no' => I('post.page_no',1),
                'page_size' => I('post.page_size',6),
                'img_num' => I('post.img_num',3),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_queryPost',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();

    }

    public function queryComment(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',0),
                'page_no' => I('post.page_no',1),
                'page_size' => I('post.page_size',6),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_queryComment',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();

    }

    public function replyThread(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',0),
                'page_no' => I('post.page_no',1),
                'page_size' => I('post.page_size',6),
                'img_num' => I('post.img_num',3),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_replyThread',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();

    }

    public function replyPost(){

        if(IS_POST){

            $data = array(
                'uid' => I('post.uid',0),
                'page_no' => I('post.page_no',1),
                'page_size' => I('post.page_size',6),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_BbsUserCenter_replyPost',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();

    }

    private function parseResult($result){
        echo "解密后数据：";
        dump($result);
    }

}